{% extends "basis.html" %}

{% block content %}

<h3>Trip Details: {{ trip_detail.trip_name }}</h3>
{% if is_owner %}
<a href="{{add_poi_uri}}">Add a &ldquo;Place of Interest&rdquo;</a>
<a href="{{edit_trip_uri}}">Edit trip details</a>
<br/>
{% endif %}

<span class="participation">
{% if is_participating %}
Hurray, you're participating in this trip. :-)
{% else %}
Bummer, it seems like you're not onboard. :-(
{% endif %}
</span>
<br/>
<div class="detailview">
<span class="date"> Start date: {{ trip_detail.start_date }}</span>
<br/>
<span class="date">End date: {{trip_detail.end_date }}</span>
<br/>
<span class="owned_by">Owned by {{trip_detail.owner}}</span>
<br/>
<span class="participants">List of participants:</span>
{% for participant in trip_detail.participants.all %}
{{ participant.username }}<br/>
{% endfor %}

</div>

<div class="poilist">
<h3>Places of Interest</h3>

{% for poi in poilist %}
<div class="singlepoi">
Place of interest: {{poi.poi_name}}<br/>
Location: {{poi.location}} <br/>
Description: {{poi.description}} <br/>
{% if poi.has_image_url %}
<a href="{{poi.backlink_url}}"><img alt="" src="{{poi.image_url}}"/></a> <br/>
{% endif %}
Is definitively a part of this trip: {% if poi.is_definitive %}YES{% else %}NO{% endif %}
{% if is_owner %}
<a href="/trips/{{trip_detail.id}}/{{poi.id}}/edit">Edit this</a>
{% endif%}
{% if is_participating %}
<form action="/trips/{{trip_detail.id}}/{{poi.id}}/vote" method="POST">{% csrf_token %}
<input type="hidden" name="pid" value="{{poi.id}}">
<input type="checkbox" name="voted" {% if poi.id in user_votes %} checked {% endif %}>
<input type="submit" value="Vote">
</form>
{% endif %}

</div>
<br/>
<br/>
{% endfor %}
</div>


{% endblock %}
